<?php

/*
*
* BEGIN pollinghandler.php
*
*
* Dazzler Server Client Communication Interface - Long Polling Handler
* @Description: handles long polling requests for site and routes them to the right long polling subroutine
* @Authors: Salman Noor, Wits University
* @Copyright: © Wits University 2011 - All Rights Reserved
* @License: BSD License (http://www.linfo.org/bsdlicense.html)
*
*
* BEGIN CHANGELOG
* Developers working on thee files are REQUIRED to maintain this CHANGELOG.
* Please ensure you follow the Changelog Guidelines: http://code.google.com/p/dazzler/wiki/DazzlerDevelopGuideline?ts=1315476570&updated=DazzlerDevelopGuideline
* !==================================================================================================================================================================
*
* VERSION 1.0.0
*	+ File Created, Salman, 12 October 2011
*
* ==================================================================================================================================================================!
* END CHANGELOG
*/


/*******************************************************************************************************************************************************************
*
* BEGIN Direct Call Check
*
/******************************************************************************************************************************************************************/
global $doNotCallThisScriptDirectly;
if ($doNotCallThisScriptDirectly != 1)
{
	/* Read the ini language file */
	$ini_lang_array = array();
	$clientlang = explode(",", strtolower($_SERVER['HTTP_ACCEPT_LANGUAGE']));
	$lang_ini_array = (file_exists("lang/" . trim($clientlang[0]) . ".ini")) ? parse_ini_file("lang/" . trim($clientlang[0]) . ".ini", true) : parse_ini_file("lang/en.ini", true);
	die ($lang_ini_array['ERRORS']['doNotCallThisScriptDirectly']);
}
/*******************************************************************************************************************************************************************
*
* END Direct Call Check
*
/******************************************************************************************************************************************************************/

/*******************************************************************************************************************************************************************
* BEGIN Marshall request types {POST, GET} but only POST are handled
/******************************************************************************************************************************************************************/

$pollType = isset($_REQUEST['pollType']) ? $_REQUEST['pollType'] : null;

if ($pollType != null)
{
    switch ($pollType) {
        case "mainStats":
        include "mainstatspoller.php";
            break;
        case "scoreCardStats":
        include "scorecardpoller.php";
            break;
          case "mymatchStats":
              include "matchstatspoller.php";
            break;
            case "liveview":
                include "liveviewpoller.php";
                break;
        default:
            break;
    }
}
?>
